how to calculate range of data types in java